<!-- Data Tables -->
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-lg-12">
            <div class="ibox float-e-margins" style="background: white;padding: 10px">
                <!-- 表单标题概要 -->
                <div class="ibox-title">
                    <h5>产品列表</h5>
                </div>
                <!--<div class="btn-group">-->
                    <!--<a class="btn btn-primary" type="button" href="add.html">-->
                        <!--<i class="fa fa-plus" aria-hidden="true" style="margin-right: 2px"> </i>-->
                        <!--添加分类-->
                    <!--</a>-->
                <!--</div>-->
                <table class="table table-bordered table-hover table-responsive">
                    <thead>
                    <tr>
                        <th>产品标识</th>
                        <th>产品描述</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {volist name="lists" id="vo"}
                    <tr>
                        <td>{$vo.product_name}</td>
                        <td>{$vo.describe}</td>
                        <td>
                            {if condition="$vo.product_name=='W'"}
                            <a href='{:url("product2","id=$vo[id]")}' class="btn btn-info" type="button">查看旗下产品</a>
                            {else/}
                            <a href='{:url("product1","id=$vo[id]")}' class="btn btn-info" type="button">查看旗下分类</a>
                            {/if}
                            <!--{eq name="$Request.session.admin.userinfo.admin_level" value="1"}-->
                            <!--<a href="javascript:void(0)" class="btn btn-danger" type="button" onclick="return del({$vo['id']})">删除</a>-->
                            <!--{/eq}-->
                        </td>
                    </tr>
                    {/volist}
                    </tbody>
                </table>

            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    //弹出确认操作
    function del(id){
        if(confirm("您确定要删除该分类及分类以下的产品吗?")){
            window.location = "doDel/id/"+id;
        }
    }
    function operateFormatter(value, row, index) {
        return [
            '<a class="btn btn-xs edit" href="javascript:void(0)" title="{$Think.lang.Edit}">',
            '<i class="fa fa-edit"></i>',
            '</a>  ',
            '<a class="btn btn-xs delete" href="javascript:void(0)" title="{$Think.lang.Delete}">',
            '<i class="fa fa-trash"></i>',
            '</a>'
        ].join('');
    }

    var operateEvents = {
        'click .edit': function (e, value, row, index) {
            var param = {
                url: "{:url('admin/user/edit');}",
                data: {id: row.id}
            }
            $("#table").gridView('loadModal', param.url,param.data)
        },
        'click .delete': function (e, value, row, index) {
            $("#table").gridView('deleteModal', 'delete', row)

        }
    };

</script>
